<?php

namespace App\Enums;

use App\Traits\EnumTrait;

class VipPeriodEnum
{
    use EnumTrait;

    const WEEKLY = ['period' => 1, 'text' => "Weekly"];
    const MONTHLY = ['period' => 2, 'text' => "Monthly"];
    const YEARLY = ['period' => 3, 'text' => "Yearly"];

    public static function getAllByStatus(): array
    {
        return array_column(self::getConstants(), "text", 'period');
    }

    public static function getStatus($data)
    {
        return $data['status'];
    }

    public static function getText($data)
    {
        return $data['text'];
    }

    public static function getTextByPeriod(int $period): ?string
    {
        $texts = self::getAllByStatus();
        return $texts[$period] ?? null;
    }
}
